package corej.course.basic;


public class TestArray1 {

    public static void main(String[] args) {
        /*
           * int[] a;	//����һ������
           * a=new int[10];	//Ϊ�������ռ�
           * for(int i=0;i<a.length;i++){
           * 		System.out.println("a["+i+"]="+a[i]);
           * }
           */        // int[] a=new int[10];

        /*
           * int[] a={1,2,3,4,5,6,7,8};	//��ʽ��ʼ��
           * for(int i=0;i<a.length;i++){
           * 		System.out.println("a["+i+"]="+a[i]);
           * }
           */
        //	[error!]	int[] b=new int[10]{3,2,5,7,4,6,9};	[error!]

        int[] a = {2, 4, 6};
        print(a);
        a = expand(a);
        print(a);

    }

    static void print(int[] m) {
        for (int i = 0; i < m.length; i++) {
            System.out.print(m[i] + "\t");
        }
        System.out.println();
    }

    static int[] expand(int[] m) {
        int[] n = new int[m.length * 2];
        System.arraycopy(m, 0, n, 0, m.length);
        return n;
    }

}